def6419b32a6683a4480e5d7f7e11c02e4dc218f,devtools/org.eclipse.xtext.testcollector/src/org/eclipse/xtext/testcollector/popup/actions/CreateTestSuiteAction.java,CreateTestSuiteAction,run,#IAction#,58

Before Change


		try {
			final IJavaElement firstPackage = getFirstPackage();
			final IJavaProject javaProject = packageFragmentRoot.getJavaProject();
			StringBuffer buffer = new StringBuffer();
			buffer.append("package " + firstPackage.getElementName() + ";\n");
			buffer.append("\n");
			buffer.append("import junit.framework.Test;\n");
			buffer.append("import junit.framework.TestSuite;\n");
			buffer.append("\n");
			buffer.append("public class " + TEST_SUITE_NAME + " {" + "\n");
			buffer.append("\n");
			buffer.append("\tpublic static Test suite() {" + "\n");
			buffer.append("\t\tTestSuite suite = new TestSuite(\"" + javaProject.getElementName() + "\");\n");

			for (IJavaElement child : packageFragmentRoot.getChildren()) {
				if (child instanceof IPackageFragment) {
					IPackageFragment packageFragment = (IPackageFragment) child;
					ICompilationUnit[] compilationUnits = packageFragment.getCompilationUnits();
					for (ICompilationUnit compilationUnit : compilationUnits) {
						for (IType type : compilationUnit.getAllTypes()) {
							if (!Flags.isAbstract(type.getFlags())) {
								if (type.getElementName().endsWith("Test") || type.getSuperclassName() != null
										&& type.getSuperclassName().contains("TestCase")) {
									buffer.append("\t\tsuite.addTestSuite(" + type.getFullyQualifiedName()
											+ ".class);\n");
									System.out.println(packageFragment.getElementName() + "." + type.getElementName());
									break;
								}

After Change


	public void run(IAction action) {
		try {
			
			List<String> testClassNames = new ArrayList<String>();
			
			for (IJavaElement child : packageFragmentRoot.getChildren()) {
				if (child instanceof IPackageFragment) {
					IPackageFragment packageFragment = (IPackageFragment) child;
					ICompilationUnit[] compilationUnits = packageFragment.getCompilationUnits();
					for (ICompilationUnit compilationUnit : compilationUnits) {
						for (IType type : compilationUnit.getAllTypes()) {
							if (!Flags.isAbstract(type.getFlags())) {
								if (type.getElementName().endsWith("Test") || type.getSuperclassName() != null
										&& type.getSuperclassName().contains("TestCase")) {
									testClassNames.add(type.getFullyQualifiedName());
									System.out.println(packageFragment.getElementName() + "." + type.getElementName());
									break;
								}